/**
 * 
 */
package com.techq.weibo.share.imp;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.log4j.Logger;

import com.techq.weibo.meta.User;
import com.techq.weibo.robot.CrawlRobot;
import com.techq.weibo.share.AbstractShare;
import com.techq.weibo.share.enums.DestShare;
import com.techq.weibo.share.enums.Target;
import com.techq.weibo.share.exception.ShareException;

/**
 * @author tassemble@gmail.com
 * 2011-8-3
 */
public class SinaShare extends AbstractShare {

	User user;
	final static String sinaWeiBoUrl = "http://weibo.com/";
	final static List<NameValuePair> params;
	
	Logger logger = Logger.getLogger(SinaShare.class);
	
	static {
		params = new ArrayList<NameValuePair>();
	}
	
	/**
	 * 
	 */
	public SinaShare() {
		super();
	}
	
	@Override
	public boolean shareVideoWithoutComment(String url, CrawlRobot robot)
			throws ShareException {
		if (!robot.hasAuthed()) {
			logger.debug(user.getUsername() + " has not authed");
			robot.auth(sinaWeiBoUrl, user);
		}
		
		logger.debug("begin to look up...");
		String shareUrl = robot.lookUp(Target.Youku, url, DestShare.Sina);
		logger.debug("share Url:" + shareUrl);
		
		robot.post(shareUrl, params);
		
		
		
		
		return false;
	}
	
	
	

}
